﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Autofac;

namespace WanMeiService
{
    public class AutoFacConfig
    {
        public static void Bootstrapper()
        {
            var builder = new ContainerBuilder();
            builder.RegisterAssemblyTypes(Assembly.Load("WanMeiService")).Where(t => t.Name.EndsWith("Controller")).AsImplementedInterfaces().InstancePerLifetimeScope();
            builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly());//.Where(n => n.Name.EndsWith("son"));
       
            builder.RegisterAssemblyTypes(Assembly.Load("WanMeiBussinessService")).Where(t => t.Name.EndsWith("Service")).AsImplementedInterfaces().InstancePerLifetimeScope(); ;
            var container = builder.Build();
            container.Resolve<UserController>();
        }
    }
}
